package com.biz.impl;

import com.alibaba.fastjson.JSONObject;
import com.biz.CustomerBiz;
import com.biz.HotelBiz;
import com.biz.facade.BillLogicUtil;
import com.core.BizException;
import com.core.Result;
import com.core.ResultGenerator;
import com.dao.BillDao;
import com.entity.bo.PayData;
import com.entity.enums.BillPayTypeEnum;
import com.entity.enums.BillStatusEnum;
import com.entity.enums.PaymentEnum;
import com.entity.model.Bill;
import com.biz.BillBiz;
import com.core.AbstractBiz;
import com.entity.model.Hotel;
import com.entity.trade.TradeData;
import com.entity.vo.BillListVO;
import com.util.MakeBillNoUtil;
import com.util.SystemConstant;
import com.util.framework.Lambda;
import com.util.framework.filter.ExistFilter;
import com.util.webpage.PageData;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;


/**
 * Created by jc on 2019/11/16.
 */
@Service
@Transactional
public class BillBizImpl extends AbstractBiz<Bill> implements BillBiz {
    @Resource
    private BillDao billDao;


    @Override
    public List<BillListVO> findCustomerBill(PageData cond) {
        List<BillListVO> listBill = billDao.findCustomerBill(cond);
        return listBill;
    }

    @Override
    public void delExpiredBillByCustomerId(Map cond) {
        billDao.delExpiredBillByCustomerId(cond);
    }

    @Override
    public BillListVO getBillDetail(Integer billId) {
        return billDao.getBillDetail(billId);
    }

    @Override
    public List<Bill> billList(PageData cond) {
        return billDao.billList(cond);
    }

    @Override
    public List<Bill> vipBillList(PageData cond) {
        return billDao.vipBillList(cond);
    }

    @Override
    public List<Bill> commissionBillList(PageData cond) {
        return billDao.commissionBillList(cond);
    }

    @Override
    public List<Bill> commissionUserBillList(PageData cond) {
        return billDao.commissionUserBillList(cond);
    }

    @Override
    public Bill findCommissionBillListSum(PageData cond) {
        return billDao.findCommissionBillListSum(cond);
    }

    @Override
    public BillListVO getTodayStatistics(Integer parentCustomerId,Integer type) {
        return billDao.getTodayStatistics(parentCustomerId,type);
    }

    @Override
    public BillListVO withdrawStatistics(Integer parentCustomerId,Integer type) {
        return billDao.withdrawStatistics(parentCustomerId,type);
    }


    @Override
    public void updateCommissionBill(Integer parentCustomerId,Integer withdrawBillId) {
        billDao.updateCommissionBill(parentCustomerId,withdrawBillId);
    }

    @Override
    public void updateCommissionBillSuccess(Integer withdrawBillId) {
        billDao.updateCommissionBillSuccess(withdrawBillId);
    }

    @Override
    public void updateCommissionBillFail(Integer withdrawBillId) {
        billDao.updateCommissionBillFail(withdrawBillId);
    }


    @Override
    public List<Bill> bdStatisticsList(PageData cond) {
        return billDao.bdStatisticsList(cond);
    }

    @Override
    public List<Bill> bdUserStatistics(PageData cond) {
        return billDao.bdUserStatistics(cond);
    }
}
